package com.bw.mapper;

import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName VoMapper
 * @description: TODO
 * @date 2025年05月09日
 * @version: 1.0
 */
@Mapper
public interface VoMapper {
    @Select("select bp.name,sum(oi.final_total_amount) `value` from order_info oi\n" +
            "left join base_province bp on bp.id = oi.province_id\n" +
            "group by bp.name;")
    List<Vo> getList();

    @Select("select bt.name,sum(final_total_amount) `value` from order_info oi\n" +
            "left join order_detail od on oi.id = od.order_id\n" +
            "left join sku_info si on si.id = od.sku_id\n" +
            "left join base_trademark bt on bt.id = si.tm_id\n" +
            "group by bt.name\n" +
            "order by `value` asc;")
    List<Vo> getList2();

    @Select("select bc1.name,sum(final_total_amount) `value` from order_info oi\n" +
            "left join order_detail od on oi.id = od.order_id\n" +
            "left join sku_info si on od.sku_id = si.id\n" +
            "left join base_category3 b on b.id = si.category3_id\n" +
            "left join base_category2 c on b.category2_id = c.id\n" +
            "left join base_category1 bc1 on c.category1_id = bc1.id\n" +
            "group by bc1.name;")
    List<Vo> getList3();

    @Select("select '用户数（人）' name,a.num1,b.num2 from\n" +
            "(select count(*) num1 from user_info where timestampdiff(year,create_time,now())<1) a,\n" +
            "(select count(*) num2 from user_info where timestampdiff(year,create_time,now())>=1)b")
    List<Vo1> getList4();
}
